package com.wind.taobao.api.trade.item.rest
{
	import com.wind.taobao.api.trade.item.convert.ItemCategoryConvert;
	import com.wind.taobao.api.trade.item.convert.ItemConvert;
	import com.wind.taobao.core.webservice.TaobaoListResponse;
	import com.wind.taobao.core.webservice.TaobaoResponse;

	import mx.collections.ArrayCollection;

	/**
	 * taobao.items.search Response
	 * @author fxy
	 *
	 */
	public class ItemsSearchResponse extends TaobaoListResponse
	{
		public var items:ArrayCollection;
		public var itemCates:ArrayCollection;

		public function ItemsSearchResponse(response:TaobaoResponse=null)
		{
			super(response);
			initItems();
		}

		private function initItems():void
		{
			if (body != null && this.isSuccess)
			{
				if (body["rsp"].hasOwnProperty("itemsearchs"))
				{
					if (body["rsp"]["itemsearchs"].hasOwnProperty("category_list"))
					{
						itemCates=ItemCategoryConvert.convertItemCategorys(body["rsp"]["itemsearchs"]["category_list"]);
					}
					if (body["rsp"]["itemsearchs"].hasOwnProperty("item_list"))
					{
						items=ItemConvert.convertItems(body["rsp"]["itemsearchs"]["item_list"]);
					}
				}
			}
		}
	}
}